using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Touming : MonoBehaviour
{
    private SpriteRenderer _spriteRenderer;

    private Color _color;

    public void Awake()
    {
        _spriteRenderer = GetComponent<SpriteRenderer>();
        _color = _spriteRenderer.color;
    }

    public void OnTriggerEnter2D(Collider2D other)
    {
        
        
        if (other.tag.Equals("player"))
        {
            _spriteRenderer.color = new Color(_color.r, _color.g, _color.b, (float)(0.8 * _color.a));
        }
    }

    public void OnTriggerExit2D(Collider2D other)
    {
        if (other.tag.Equals("player"))
        {
            _spriteRenderer.color = new Color(_color.r, _color.g, _color.b, _color.a);
        }
    }
}